package kr.co.nextree.android.sample.activity;

import kr.co.nextree.android.sample.R;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.SubMenu;
import android.widget.Toast;

public class OptionMenuTest extends Activity {
	private static final int MENU_ONE = 0;
	private static final int MENU_TWO = 1;
	private static final int MENU_THREE = 2;
	private static final int MENU_FOUR = 3;
	private static final int MENU_FIVE = 4;
	private static final int MENU_SIX = 5;
	private static final int MENU_SEVEN = 6;
	
	private boolean isEnabled = true;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		super.onCreateOptionsMenu(menu);
		MenuInflater inflater = getMenuInflater();
        inflater.inflate(R.menu.option_menu, menu);
		
/*		SubMenu sm = menu.addSubMenu(0, MENU_ONE, Menu.NONE, "One").setIcon(android.R.drawable.ic_menu_add);
		sm.add(1, 10, 0, "부항목 01");
		sm.add(1, 11, 1, "부항목 02");
		
		
		menu.add(0, MENU_TWO, Menu.NONE, "Two").setIcon(android.R.drawable.ic_menu_agenda);
		menu.add(0, MENU_THREE, Menu.NONE, "Three").setIcon(android.R.drawable.ic_menu_call);
		menu.add(0, MENU_FOUR, Menu.NONE, "Four").setIcon(android.R.drawable.ic_menu_camera);
		menu.add(0, MENU_FIVE, Menu.NONE, "Five").setIcon(android.R.drawable.ic_menu_close_clear_cancel);
		menu.add(0, MENU_SIX, Menu.NONE, "Six").setAlphabeticShortcut('x');
		menu.add(0, MENU_SEVEN, Menu.NONE, "Seven").setAlphabeticShortcut('v');*/
		
		return true;
	}

	@Override
	public boolean onPrepareOptionsMenu(Menu menu) {
		return super.onPrepareOptionsMenu(menu);
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		switch (item.getItemId()) {
		case R.id.menuOne:
			Toast.makeText(this, "아이템 " + item.getItemId() + "선택", Toast.LENGTH_SHORT).show();
			return true;
		case MENU_ONE:
			Toast.makeText(this, "아이템 " + item.getItemId() + "선택", Toast.LENGTH_SHORT).show();
			return true;
		case MENU_TWO:
			Toast.makeText(this, "아이템" + item.getItemId() + "선택", Toast.LENGTH_SHORT).show();
			return true;
		case MENU_THREE:
			Toast.makeText(this, "아이템" + item.getItemId() + "선택", Toast.LENGTH_SHORT).show();
			return true;
		case MENU_FOUR:
			Toast.makeText(this, "아이템" + item.getItemId() + "선택", Toast.LENGTH_SHORT).show();
			return true;
		case MENU_FIVE:
			Toast.makeText(this, "아이템" + item.getItemId() + " 선택", Toast.LENGTH_SHORT).show();
			return true;
		case MENU_SIX:
			Toast.makeText(this, "아이템" + item.getItemId() + "선택", Toast.LENGTH_SHORT).show();
			return true;
		case MENU_SEVEN:
			Toast.makeText(this, "아이템" + item.getItemId() + "선택", Toast.LENGTH_SHORT).show();
			return true;
		}
		
		return super.onOptionsItemSelected(item);
	}
	
	
}
